c_quaternion::c_quaternion(const float *values)
    : D3DXQUATERNION(values)
{

}

c_quaternion::c_quaternion(const D3DXQUATERNION& q)
{
    *this = q; 
}

c_quaternion::c_quaternion(const float x, const float y, const float z, const float w)
    : D3DXQUATERNION(x, y, z, w)
{

}

c_quaternion c_quaternion::Identity()
{
    c_quaternion identity;
    D3DXQuaternionIdentity(&identity);
    return identity;
}

void c_quaternion::from_matrix4x4(const c_matrix4x4& mat)
{
    c_quaternion result = c_quaternion::Identity(); 
    D3DXQuaternionRotationMatrix(&result, &mat); 
    *this = result;
}

c_matrix4x4 c_quaternion::to_matrix4x4() const
{
    c_matrix4x4 result = c_matrix4x4::Identity();
    D3DXMatrixRotationQuaternion(&result, this); 
    return result;
}

c_quaternion c_quaternion::operator = (const D3DXQUATERNION& arg)
{
    if (this == &arg)   
        return *this;
    *this = arg; 
}